package hy.dao;

import hy.entity.Order;
import hy.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/*
create database db0;
create database db1;
use db0;
create table t_order0(id bigint primary key,customer_id int,order_amount int);
create table t_order1(id bigint primary key,customer_id int,order_amount int);
use db1;
create table t_order0(id bigint primary key,customer_id int,order_amount int);
create table t_order1(id bigint primary key,customer_id int,order_amount int);
*/
@Repository
@Mapper
public interface OrderDao {
    @Insert("insert into t_order(customer_id) values(#{customerId})")
    void addOrder(Order o);
    @Select("select * from t_order")
    List<User> selectAll();

    @Select("select * from t_order")
    List<Order> selectOrders();
    @Select("select * from t_order where id=#{id}")
    Order selectOrderById(Long id);
}
